package leetcode.code1561;

import java.util.Arrays;

//1561. 你可以获得的最大硬币数目
public class Solution {
	public int maxCoins(int[] piles) {
		int n3 = piles.length;
		Arrays.sort(piles);
		int ans = 0;
		for (int i = n3 - 2, j = 0; j < n3 / 3; i -= 2, j++) {
			ans += piles[i];
		}
		return ans;
	}
}
